/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.arguscab.game;

import hu.arguscab.ai.Operation;
import java.util.EnumSet;

/**
 *
 * @author sharp
 */
public class GameCompoundAction extends CompoundAction {

	EnumSet<GameAction> actions;

	public GameCompoundAction() {
		actions = EnumSet.allOf(GameAction.class);
		actions.clear();;
	}

	@Override
	public boolean hasAction(Operation ac) {
		return actions.contains((GameAction)ac);
	}

	@Override
	public void addAction(Operation ac) {
		actions.add((GameAction)ac);
	}

	@Override
	public void clear() {
		actions.clear();
	}

	@Override
	public String toString() {
		return actions.toString();
	}

	@Override
	public void copyActions(CompoundAction actions) {
		this.clear();
		if ( actions == null )
			return;
		for ( GameAction ac : GameAction.values() ) {
			if ( actions.hasAction(ac) )
				this.addAction(ac);
		}
	}
}
